/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.controller;

import com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.dto.CaseTransferRecordFileDto;
import com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.dto.CaseTransferSourceIdDto;
import com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.model.CaseTransferRecordFile;
import com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.service.ICaseTransferRecordFileService;
import com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.service.ICaseTransferRecordService;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 描述: 案件移交材料证据表 case_transfer_record_file 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年12月09日
 */
@RestController
@RequestMapping("/punish/ucase/case/investigate/transfer/file")
public class CaseTransferRecordFileController extends BaseController {

    @Resource
    private ICaseTransferRecordFileService caseTransferRecordFileService;
    @Resource
    private ICaseTransferRecordService caseTransferRecordService;

    /**
     * 保存案件移交材料
     *
     * @param caseTransferRecordFileDto 案件移交材料参数对象
     * @return com.icinfo.framework.common.web.Result<java.lang.String>
     * @author liuyongfei
     * @date 2022/12/09
     */
    @PostMapping(value = "/saveCaseTransferRecordFile")
    public Result<String> saveCaseTransferRecordFile(@RequestBody @Validated CaseTransferRecordFileDto caseTransferRecordFileDto) {
        return caseTransferRecordFileService.saveCaseTransferRecordFile(caseTransferRecordFileDto);
    }

    /**
     * 查询案源文书记录
     *
     * @param caseTransferSourceIdDto 案源id
     * @return com.icinfo.framework.common.web.Result<java.util.List < com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.model.CaseTransferRecordFile>>
     * @author liuyongfei
     * @date 2022/12/12
     */
    @PostMapping(value = "/getSourceDocumentRecord")
    public Result<List<CaseTransferRecordFile>> getSourceDocumentRecord(
            @RequestBody @Validated CaseTransferSourceIdDto caseTransferSourceIdDto) {
        return caseTransferRecordFileService.getSourceDocumentRecord(caseTransferSourceIdDto);
    }

    /**
     * 校验案源移交时关联对象是否为空
     *
     * @param caseTransferSourceIdDto 案源id参数对象
     * @return com.icinfo.framework.common.web.Result<Boolean>
     * @author liuyongfei
     * @date 2022/12/15
     */
    @PostMapping(value = "/checkSourceTransferParties")
    public Result<Boolean> checkSourceTransferParties(
            @Validated @RequestBody CaseTransferSourceIdDto caseTransferSourceIdDto) {
        return caseTransferRecordService.checkSourceTransferParties(caseTransferSourceIdDto.getCaseSourceId());
    }
}